package com.bianmaba.spring.data.jpa.domain.entity;


import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;

/**
 * 基本实体类，此类包含字符串（UUID）ID字段，一个子类一个表，父类不会生成表。
 *
 * @author cWX183898
 */
@MappedSuperclass
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class UuidIdentityEntity implements IEntity {
    @Id
    @GenericGenerator(name = "uuidGenerator", strategy = "uuid")
    @GeneratedValue(generator = "uuidGenerator", strategy = GenerationType.IDENTITY)
    @Column(length = 36, nullable = false)
    protected String id;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
}
